﻿using MvcSample.Data.Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace MvcSample.Models
{
    public class StudentOutputDto
    {
        public StudentOutputDto()
        { }
        public StudentOutputDto(Student s)
        {
            Age = DateTime.Now.Subtract(s.BirthDay).Days / 365;
            Gender = s.Gender;
            Name = $"{s.FirstName}{s.LastName}";
            Id = s.Id;
        }
        [Display(Name ="Id")]
        public int Id { get; set; }
        [Display(Name = "名称")]
        public string Name { get; set; }
        [Display(Name = "年龄")]
        public int Age { get; set; }
        [Display(Name = "性别")]
        public GenderEnum Gender { get; set; }
    }
}
